package com.valley.dream.tihai.util.network;

import com.google.gson.Gson;

import okhttp3.FormBody;
import okhttp3.MediaType;
import okhttp3.RequestBody;

public class JsonUtil {

    //    UserInfoBean userInfoBean = new UserInfoBean("18808086666", "1");
    //    RequestBody body = FormBody.create(MediaType.parse("application/json; charset=utf-8"), new Gson().toJson(userInfoBean));
    //    //接口对象实例调用相关接口，获得Observable对象
    //    Observable<BaseModel> observable = api.updateUserInfo3(body);
    public static RequestBody toJson(Object bean){
        RequestBody body = FormBody
                .create(MediaType.parse("application/json; charset=utf-8"),
                new Gson().toJson(bean));
        return body;
    }
}
